
//

import UIKit

//模型数据
class CZStatus: NSObject {
    
    //发布时间
    var created_at: String?
    //id
    var id: Int64 = 0
    //微博内容
    var text: String?
    //  来源
    var source: String?
    //关注的用户对象
    var user: CZUser?
    
    //  转发数
    var reposts_count: Int = 0
    //  评论数
    var comments_count: Int = 0
    //  表态数(赞)
    var attitudes_count: Int = 0
    
    // 转发微博对象
    var retweeted_status: CZStatus?
    
    
    
    
    //  kvc构造函数
    init(dic: [String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dic)
        
    }
    
    override func setValue(value: AnyObject?, forKey key: String) {
        if key == "user"{
            guard let dic = value as? [String: AnyObject] else {
                
                return
            }
            //执行到这说明是我们想要的字典
            user = CZUser(dict: dic)
         print(user)
        } else if key == "retweeted_status" {
            
            guard let dict = value as? [String: AnyObject] else {
                return
                
            }
            //执行到这说明得到字典
            retweeted_status = CZStatus(dic: dict)

        } else {
            super.setValue(value, forKey: key)
        }
        
    }
    
    
    //防止崩溃
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
}






